package tcp.longconnection.client.protocol;

import java.io.ByteArrayOutputStream;
import java.util.UUID;

public class RegisterProcotol extends BasicProtocol {
	
	public static final String REGISTERCOMMAND = "0004";
	public String selfUUID = "00000000000000000000000000000000";
	
	public RegisterProcotol() {
		this.selfUUID = UUID.randomUUID().toString();
	}
	
	@Override
	public String getCommand() {
		return REGISTERCOMMAND;
	}

	@Override
	public byte[] getContentData() {
		byte[] pre = super.getContentData();
		ByteArrayOutputStream bos = new ByteArrayOutputStream(BasicProtocol.SLEFUUID_LEN + BasicProtocol.COMMEND_LEN + BasicProtocol.VERSION_LEN);
		bos.write(pre, 0, pre.length);
		bos.write(selfUUID.getBytes(), 0, BasicProtocol.SLEFUUID_LEN);
		return bos.toByteArray();
	}

}
